const path = require("path");

function resolve(dir) {
  return path.join(__dirname, dir);
}

module.exports = {
  productionSourceMap: false,
  css: {
    sourceMap: true,
    loaderOptions: {
      // 一次配置，全局使用，这个scss 因为每个文件都要引入
      sass: {
        prependData: `@import "@styles/global.scss";`
      }
    }
  },
  chainWebpack: config => {
    // 配置解析别名
    config.resolve.alias
      .set("@$", resolve("./src"))
      .set("@assets", resolve("./src/assets/fonts"))
      .set("@assetsImg", resolve("./src/assets/images"))
      .set("@styles", resolve("./src/assets/styles"))
      .set("@js", resolve("./src/assets/js"))
      .set("@com", resolve("./src/components"))
      .set("@api", resolve("./src/apis"));
  }
};
